package com.wangzhixuan.commons.filestorage;


import com.wangzhixuan.commons.filestorage.local.LocalFileStorageServerImpl;

import java.util.HashMap;
import java.util.Map;

/**
 * 对象存储 工厂类
 *
 * @author lixin
 */
public class FileStorageFactory {
    /**
     * 对象存储操作类
     */
    private static final Map<FileStorageEnum, BaseFileStorageService> OPERATION_MAP;

    static {
        OPERATION_MAP = new HashMap<>();
        OPERATION_MAP.put(FileStorageEnum.LOCAL, new LocalFileStorageServerImpl());
    }

    /**
     * 获取业务实例
     *
     * @param storageEnum 类型
     * @return 业务实例
     */
    public static BaseFileStorageService getService(FileStorageEnum storageEnum) {
        return OPERATION_MAP.get(storageEnum);
    }

}
